package com.imooc.converter;

import com.imooc.dataobject.ProductInfo;
import com.imooc.enums.ProductStatusEnum;
import com.imooc.form.ProductForm;
import org.springframework.beans.BeanUtils;

/**
 * FileName: ProductForm2ProductInfoConverter.java
 * Description: ProductForm -> ProductInfo
 *
 * @author HuangRI(874668739 @ qq.com)
 * @version 1.0
 * @date 2020/12/31
 */
public final class ProductForm2ProductInfoConverter {

    private ProductForm2ProductInfoConverter() {}

    /**
     * 转换方法
     * @param productForm ProductForm
     * @return ProductInfo
     */
    public static ProductInfo convert(ProductForm productForm) {
        if (null == productForm) {
            return new ProductInfo();
        }

        ProductInfo productInfo = new ProductInfo();
        BeanUtils.copyProperties(productForm, productInfo);
        return productInfo;
    }
}
